package edu.sctu.wulixia.month4and5.day20150524;

/**
 * Created by user05 on 2015/5/24.
 */
/*
 TextMore有三个方法，sotrNumber()一个是对老师学号进行排序，
 sortStudent()一个是对老师所教学生成绩进行排序。
 pritCoded()一个是对老师职称为教授的进行返回
 */
public class TestMore {
    Teacher_Info teacher = new Teacher_Info();

    public Teacher[] sotrNumber(){

        Teacher[] teacherarray = teacher.isTeachersMassage();
        Teacher[] teachera = new Teacher[1];

        for (int i = 0; i < (teacherarray.length-1); i++) {
            for (int j = 0; j < (teacherarray.length-1); j++) {
                if (teacherarray[j].getNumber() > teacherarray[j+1].getNumber()){
                    teachera[0] = teacherarray[j];
                    teacherarray[j] = teacherarray[j+1];
                    teacherarray[j+1] =teachera[0];
                }
            }
        }
        return teacherarray;
    }

    public void sortStudent(Student[] student){
        Student[] studentone = new Student[student.length];
        Student[] studentA = new Student[1];
        for(int i = 0;i<(studentone.length-1);i++){
            for(int j = 0;j<(studentone.length-1);j++){
                if (student[j].getNumber() > student[j+1].getNumber()){
                    studentA[0] = student[j];
                    student[j] = student[j+1];
                    student[j+1] = studentA[0];

                }
            }
        }
    }

    public Teacher printCode(){
        Teacher teacher_info = new Teacher();
        Teacher teacher_professor = null;
        Teacher[] teachers_postion = teacher.isTeachersMassage();

        for (int i = 0 ;i<teachers_postion.length; i++){
            if (teacher_info.getPosition().equals("教授")){
                    teacher_professor = teacher_info;
            }
        }
        return teacher_professor;
    }
}
